//
//  YFUserAccount.swift
//  微博
//
//  Created by 余仿 on 16/4/9.
//  Copyright © 2016年 YF. All rights reserved.
//

import UIKit

class YFUserAccount: NSObject {

    //13277929649@163.com   yufang93@mzj

    //姓名
    var name:String?

    //id
    var uid:String?

    //权限
    var access_token:String?

    //头像
    var avatar_large:String?

    //token生命周期
    var expires_in: Int = 0

    //token的过期时间
    var expires_date:NSDate{
        //获取token的时间加上声明周期
        //TODO:测试账号?
        return NSDate(timeIntervalSinceNow: Double(expires_in))

    }


    init(dict:[String:AnyObject]) {

        super.init()

        //字典转模型
        setValuesForKeysWithDictionary(dict)
        
    }

    override var description: String {
        let keys = ["name","access_token","avatar_large","expires_in","uid"]

        let dict = self.dictionaryWithValuesForKeys(keys)
        return dict.description

    }

    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }

}


